package com.world.blog.domain;

import com.world.common.core.domain.BaseEntity;
import com.world.common.utils.AssertUtil;
import lombok.Data;
import com.world.common.annotation.Excel;

import java.util.List;

/**
 * 文章对象 blog_article
 * 
 * @author LiJunXi
 * @date 2025-05-19
 */
@Data
public class BlogArticle extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 文章ID */
    private Long articleId;

    /** 用户ID */
    @Excel(name = "用户ID")
    private Long userId;

    /** 标题 */
    @Excel(name = "标题")
    private String title;

    /** MD内容 */
    @Excel(name = "MD内容")
    private String mdContent;

    /** HTML内容 */
    @Excel(name = "HTML内容")
    private String htmlContent;

    /** 摘要 */
    @Excel(name = "摘要")
    private String summary;

    /** 浏览量 */
    @Excel(name = "浏览量")
    private Integer viewsCount;

    /** 点赞量 */
    @Excel(name = "点赞量")
    private Integer likeCount;

    /** 收藏量 */
    @Excel(name = "收藏量")
    private Integer collectCount;

    /** 评论量 */
    @Excel(name = "评论量")
    private Integer commentCount;

    /** 文章分类 */
    @Excel(name = "文章分类")
    private Long categoryId;

    /** 文章标签 */
    @Excel(name = "文章标签")
    private List<Long> tags;

    /** 是否置顶 */
    @Excel(name = "是否置顶")
    private Integer isTop;

    /** 是否评论 */
    @Excel(name = "是否评论")
    private Integer isNeedComment;

    /** 封面 */
    @Excel(name = "封面")
    private String articleCover;

    /** 状态 */
    @Excel(name = "状态")
    private Integer status;

    private String userName;

    private String nickName;

    private String avatar;

    public void checkSaveParams() {
        AssertUtil.isNotEmpty(title, "标题不能为空");
        AssertUtil.isNotEmpty(mdContent, "内容不能为空");
        AssertUtil.isNotEmpty(htmlContent, "内容不能为空");
        AssertUtil.isNotEmpty(tags, "标签不能为空");
        AssertUtil.isNotEmpty(categoryId, "分类不能为空");
        AssertUtil.isNotEmpty(articleCover, "封面不能为空");
        AssertUtil.isNotEmpty(isTop, "是否置顶不能为空");
        AssertUtil.isNotEmpty(isNeedComment, "是否评论不能为空");
    }


}
